package ru.niir.goodfil.c1;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import com.thoughtworks.xstream.annotations.XStreamImplicit;

import java.util.ArrayList;
import java.util.List;

@XStreamAlias("Order")
public class Order
{
    @XStreamAsAttribute
    private long idIS;

    @XStreamAsAttribute
    private String id1C;

    @XStreamAsAttribute
    private String idClient1c;

    @XStreamAsAttribute
    private String idClientIS;

    @XStreamAsAttribute
    private String creationDate;

    @XStreamAsAttribute
    private String address;

    @XStreamAsAttribute
    private String firm;

    @XStreamAsAttribute
    private String priceColumn;

    @XStreamAsAttribute
    private String blockCheck;

    @XStreamImplicit
    private List<OrderItem> items = new ArrayList<OrderItem>();

    public Order()
    {
    }

    public Order(long idIS, String id1C, String idClient1c, String idClientIS, String creationDate, String address, String firm)
    {
        this.idIS = idIS;
        this.id1C = id1C;
        this.idClient1c = idClient1c;
        this.idClientIS = idClientIS;
        this.creationDate = creationDate;
        this.address = address;
        this.firm = firm;
        this.priceColumn = null;
    }

    public Order(long idIS, String id1C, String idClient1c, String idClientIS, String creationDate, String address, String firm, String priceColumn, String blockCheck)
    {
        this.idIS = idIS;
        this.id1C = id1C;
        this.idClient1c = idClient1c;
        this.idClientIS = idClientIS;
        this.creationDate = creationDate;
        this.address = address;
        this.firm = firm;
        this.priceColumn = priceColumn;
        this.blockCheck = blockCheck;
    }


    public String getPriceColumn() {
        return priceColumn;
    }

    public void setPriceColumn(String priceColumn) {
        this.priceColumn = priceColumn;
    }

    public long getIdIS()
    {
        return idIS;
    }

    public void setIdIS(long idIS)
    {
        this.idIS = idIS;
    }

    public String getId1C()
    {
        return id1C;
    }

    public void setId1C(String id1C)
    {
        this.id1C = id1C;
    }

    public String getIdClient1c()
    {
        return idClient1c;
    }

    public void setIdClient1c(String idClient1c)
    {
        this.idClient1c = idClient1c;
    }

    public String getIdClientIS()
    {
        return idClientIS;
    }

    public void setIdClientIS(String idClientIS)
    {
        this.idClientIS = idClientIS;
    }

    public String getCreationDate()
    {
        return creationDate;
    }

    public void setCreationDate(String creationDate)
    {
        this.creationDate = creationDate;
    }

    public String getAddress()
    {
        return address;
    }

    public void setAddress(String address)
    {
        this.address = address;
    }

    public String getFirm()
    {
        return firm;
    }

    public void setFirm(String firm)
    {
        this.firm = firm;
    }

    public List<OrderItem> getItems()
    {
        if (items == null) items = new ArrayList<OrderItem>();
        return items;
    }

    public void setItems(List<OrderItem> items)
    {
        this.items = items;
    }

    @Override
    public String toString()
    {
        return "Order{" +
               "idIS=" + idIS +
               ", id1C='" + id1C + '\'' +
               ", idClient1c='" + idClient1c + '\'' +
               ", idClientIS='" + idClientIS + '\'' +
               ", priceColumn='" + priceColumn + '\'' +
               ", creationDate='" + creationDate + '\'' +
               ", items=" + items +
               '}';
    }
}
